<template>
  <div class="index-attendance">
    <AttendanceIndex :chooseTab="chooseTab" v-if="['1', '2', '4', '5'].includes($route.query.type)" />
    <div class="check_attendance sub-margin" v-else>
      <div class="sub-page-title sub-page-return">
        <el-button size="small" icon="el-icon-arrow-left" @click.stop="returnPage">返回</el-button>
        日常考勤
      </div>
      <div class="content">
        <AttendOneRight :id="$route.query.id" :formId="$route.query.formId" :keysItem="keysItem" staticsShow="1" />
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import AttendanceIndex from './index.vue'
import AttendOneRight from './components/AttendOneRight.vue'
export default {
  name: 'indexAttendance',
  components: { AttendanceIndex, AttendOneRight },
  props: {},
  data() {
    return {
      chooseTab: '2',
      keysItem: {},
    }
  },
  watch: {},
  computed: {
    ...mapGetters('role', ['isOtherRole', 'isNormalRole', 'isAdminRole', 'isMainRole', 'isOrgRole', 'isPartRole']),
  },
  created() {
    this.keysItem = {
      processInstanceId: this.$route.query.processInstanceId,
      taskId: this.$route.query.taskId,
    }
    // 1审核，2退回，3知会，4系统消息
    if (this.$route.query.type === '1' || this.$route.query.type === '3') {
      this.chooseTab = '1' // 审批
    } else if (this.$route.query.type === '5') {
      this.chooseTab = '6' // 统计汇总
    } else {
      this.chooseTab = '3' // 表单
    }
  },
  mounted() {},
  methods: {
    // 返回
    returnPage() {
      this.$router.go(-1)
    },
  },
}
</script>
<style lang="scss" scoped>
@import '@styles/layout.scss';
.index-attendance {
  height: 100%;
  .check_attendance {
    height: 100%;
  }
  .content {
    flex: 1;
    padding: 20px 0;
    height: calc(100% - 80px);
  }
}
</style>
